import 'dart:convert';

T? asT<T>(dynamic value) {
  if (value is T) {
    return value;
  }
  return null;
}

class AcBlockedModel {
  AcBlockedModel({
    required this.nickName,
    required this.avatar,
    required this.age,
    required this.registerCountry,
    required this.broadcasterId,
    required this.gender,
  });

  factory AcBlockedModel.fromJson(Map<String, dynamic> json) => AcBlockedModel(
    nickName: asT<String>(json['nickName'])!,
    avatar: asT<String>(json['avatar'])!,
    age: asT<int>(json['age'])!,
    registerCountry: asT<String>(json['registerCountry'])!,
    broadcasterId: asT<String>(json['broadcasterId'])!,
    gender: asT<int>(json['gender'])!,
  );

  String nickName;
  String avatar;
  int age;
  String registerCountry;
  String broadcasterId;
  int gender;

  @override
  String toString() {
    return jsonEncode(this);
  }

  Map<String, dynamic> toJson() => <String, dynamic>{
    'nickName': nickName,
    'avatar': avatar,
    'age': age,
    'registerCountry': registerCountry,
    'broadcasterId': broadcasterId,
    'gender': gender,
  };
}
